package online.hxstart.code.concurrent.chapter09;

/**
 * @author huxing
 * @date 2019/7/11 星期四 18:45
 * @describe
 */
public class Singleton {


  private static Singleton ourInstance = new Singleton();

  private static int x = 0;

  private static int y;


  public static Singleton getInstance() {
    return ourInstance;
  }

  private Singleton() {
    System.out.println("使用 new 方法");

    x++;
    y++;
  }

  public static void main(String[] args) {

    System.out.println(System.getProperty("data"));
    Singleton singleton = Singleton.getInstance();
    System.out.println(singleton.x);
    System.out.println(singleton.y);
  }
}
